<% content_for :header do %>
	<%= javascript_include_tag :defaults %>
<% end %>

<% content_for :top_menu do %>
  <%= link_to "Назад", admin_root_path %>
<% end %>

<% form_for [:admin, @search] do |f| %>

  <%= javascript_include_tag 'delegate', 'forms' %>
  <script type="text/javascript">
    //<![CDATA[
      var price='<%= generate_template(f, :prices) %>';
      var number='<%= generate_template(f, :numbers) %>';
      var loc='<%= generate_template(f, :locations) %>';
      var beach='<%= generate_template(f, :beaches) %>';
    //]]>
  </script>

	<h2>Расположение</h2>
  <div id="loc">
    <% f.fields_for :locations do |form| %>
      <%= render :partial => "location", :locals => {:f => form} %>
    <% end %>
  </div>
  <p>
    <%= add_link("Добавить расположение", "loc", "loc") %>
  </p>

	<h2>Цены</h2>
  <div id="prices">
    <% f.fields_for :prices do |form| %>
      <%= render :partial => "price", :locals => {:f => form} %>
    <% end %>
  </div>
  <p>
    <%= add_link("Добавить цену", "price") %>
  </p>

	<h2>Количество комнат</h2>
  <div id="numbers">
    <% f.fields_for :numbers do |form| %>
      <%= render :partial => "number", :locals => {:f => form} %>
    <% end %>
  </div>
  <p>
    <%= add_link("Добавить количество комнат", "number") %>
  </p>

	<h2>Пляжи</h2>
  <div id="beaches">
    <% f.fields_for :beaches do |form| %>
      <%= render :partial => "beach", :locals => {:f => form} %>
    <% end %>
  </div>
  <p>
    <%= add_link("Добавить пляж", "beach") %>
  </p>

	<p>
		<%= submit_tag "Обновить" %>
	</p>
<% end %>
